<?php
class BankPaymentReplay {
	
	/**
	 * @var Int
	 */
	private $logId = 0;
	/**
	 * @var Int
	 */
	private $uid = 0;
	/**
	 * Possible values
	 * 0 - Callback is not yet handled.
	 * 1 - Success
	 * 2 - Payment already handled
	 * 3 - User cancelled payment
	 * 4 - Invalid signature..
	 * 99 - unknown error
	 * @var Int
	 */
	private $status = 0;
	/**
	 * @var String
	 */
	private $statusStr = '';
	/**
	 * @var String
	 */
	private $bankError = '';
	/**
	 * @var String
	 */
	private $bankErrorStr = '';
	/**
	 * @var Array
	 */
	private $userData = array();
	/**
	 * @var String
	 */
	private $description = '';
	/**
	 * @var Float
	 */
	private $price = 0.0;
	/**
	 * @var String
	 */
	private $currency = '';
	
	public function __construct( ) {}
	
	public function __set( $var, $value ) {
		switch( $var ) {
			case 'status':
				$this->status = (int)$value;
				$messages  = array(
					0 => 'Input error',
					1 => 'Payment handled successfully',
					2 => 'Payment already handled',
					3 => 'User cancelled payment',
					4 => 'Invalid signature',
					99 => 'Unknown error',
				);
				$this->statusStr = $messages[$this->status];
			break;
			case 'uid':
				$this->uid = (int)$value;
			break;
			case 'logId':
				$this->logId = (int)$value;
			break;
			case 'price':
				$this->price = (float)$value;
			break;
			default:
				$this->$var = $value;
			break;
		}
	}
	
	public function __get( $var ) {
		return $this->$var;
	}
	
}
?>